package com.imooc.async;

import com.imooc.retry.RetryComponent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 异步任务
 * @author liansen
 * @create 02-15-17:47
 */
@Slf4j
@Component
public class AsyncTask {

    @Autowired
    private RetryComponent retryComponent;

    @Async
    public String SmsTask(){
        String code = retryComponent.sendSmsWithRetry();
        //{}是占位符
        log.info("利用异步任务生成验证码{}", code);
        return code;
    }
}
